// pages/building/building.js

Page({
  /**
   * 页面的初始数据
   */
  handleIndex(data) {
    this.setData({
      currentTab: data.detail,
    });
  },
  data: {
    tabList: ["教学区", "第一生活区","第二生活区","其他区域"],
    currentTab: 0,
    menuArray: [
      [
        "明义1",
        "明义2",
        "明义3",
        "明义4",
        "明义5",
        "锐思1",
        "锐思2",
        "锐思3",
        "锐思4",
        "弘毅1",
        "弘毅2",
        "弘毅3",
        "弘毅4",
        "致远1",
        "致远2",
        "致远3",
        "致远4",
      ],
      ["一区B1","一区B2","一区B3","一区B4","一区C1","一区C2","一区C3","一区C4","一区C5","一区C6","一区D1","一区D2","一区D3","一区D4","一区D5","一区D6","一区D7","一区D8-A","一区D8-B","一区F1","一区F2","一区F3","一区F4",],
      ["二区A1","二区A2","二区A3","二区A4","二区A5","二区A6","二区A7","二区B1","二区B2","二区B3","二区B4","二区B5","二区B6","二区B7","二区B8","二区B9","二区B10","二区B11","二区B12","二区B13","二区B14","二区C1","二区C2","二区C3"],
      ["图书馆", "田径场"],
    ],
  },
  //选择楼栋
  chooseBuilding(e) {
    const { value } = e.currentTarget.dataset;

    //获取页面栈
    const pages = getCurrentPages();
    // console.log(pages)
    //获取上一页
    const prepage = pages[pages.length - 2];
    // 对上一页的地址进行赋值
    prepage.setData({ "addressInfo.building": value });
    //返回上一页
   wx.navigateBack()
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {},

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {},

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {},

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {},

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {},

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {},

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {},

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {},
});
